<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */

class b2c_analysis_chongzhi extends ectools_analysis_abstract implements ectools_analysis_interface{
    public $logs_options = array();

	public function __construct(&$app){
		parent::__construct($app);
		$this->logs_options = array(
			'1' => array(
				'name' => app::get('b2c')->_('登记录入金额'),
				'flag' => array(),
				'memo' => app::get('b2c')->_('门店充值的未审核'),
				'icon' => 'money_add.gif',
			),
			'2' => array(
				'name' => app::get('b2c')->_('审核通过金额'),
				'flag' => array(),
				'memo' => app::get('b2c')->_('真实存进系统的预存款'),
				'icon' => 'coins.gif',
			),
		);
	}

    public $graph_options = array(
        'hidden' => true,
    );
    
    public function ext_detail(&$detail){
        $filter = $this->_params;
        $filter['time_from'] = isset($filter['time_from'])?strtotime($filter['time_from']):'';
        $filter['time_to'] = isset($filter['time_to'])?(strtotime($filter['time_to'])+86400):'';

        $chongzhiObj = $this->app->model('analysis_chongzhi');
        $chongzhi_money = $chongzhiObj->chongzhi_money($filter);
        $shenhe_money = $chongzhiObj->shenhe_money($filter);
        // $useNum = $chongzhiObj->get_member_num();

        $detail['登记录入金额']['value'] = $chongzhi_money['import_money'];
        $detail['审核通过金额']['value'] = $shenhe_money['import_money'];
    }

    public function finder()
    {
        return array(
            'model' => 'b2c_mdl_analysis_chongzhi',
            'params' => array(
                // 'actions'=>array(
                //     array(
                //         'label'=>app::get('b2c')->_('生成报表'),
                //         'class'=>'export',
                //         'icon'=>'add.gif',
                //         'href' => 'index.php?app=importexport&ctl=admin_export&act=export_view&_params[app]=b2c&_params[mdl]=b2c_mdl_analysis_advance',
                //         'target'=>'{width:400,height:170,title:\''.app::get('b2c')->_('生成报表').'\'}'),
                // ),
                'title'=>app::get('b2c')->_('充值记录统计'),
                'use_buildin_recycle'=>false,
                'use_buildin_selectrow'=>false,
            ),
        );
    }
}
